<?php

/**
 * Class to provide emoticon capability for CryoBB.
 *
 * @package CryoBB
 * @filename Emoticons.php
 * @version 1.0.0
 * @author Scott Martin <sjm.dev1[at]gmail[dot]com>
 * @date November 5th, 2010
 * @license GNU GPL V3
 */
class CryoBB_Emoticons
{
	//emoticon holder
	private $emoticons = array();
	
	//determines if emoticon text replacement is case sensitive
	private $isCaseSensitive = false;
	
	/**
	 * Sets whether emoticon text replacement is case sensitive or not
	 *
	 * @param boolean $bool
	 * @access public
	 * @return void
	 */
	public function isCaseSensitive($bool)
	{
		$this->isCaseSensitive = (bool) $bool;
	}
	
	/**
	 * Adds an array of emoticons in the format of 'text' => 'image'
	 *
	 * @param array $array
	 * @access public
	 * @return void
	 */
	public function addEmoticons($array)
	{	
		foreach ($array AS $k => $v)
		{
			$this->emoticons[$k] = $v;
		}
	}
	
	/**
	 * Adds a single emoticon
	 *
	 * @param string $text - text to be replaced with $image
	 * @param string $image - image to replace the $text with
	 * @access public
	 * @return void
	 */
	public function addEmoticon($text, $image)
	{
		$this->emoticons[$text] = $image;
	}
	
	//getter
	public function __get($var)
	{
		return isset($this->$var) ? $this->$var : false;
	}
}